import { createApp } from 'vue'
import VueGtag, { PageView } from "vue-gtag"
import type { RouteLocationNormalized } from 'vue-router'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import ScriptX from 'vue-scriptx'
import { Popup, Toast, Lazyload } from 'vant';
import 'vant/lib/index.css';

import './assets/style/normal.scss'
import './assets/style/common.scss'

import BiBoot from './components/bi-boot'
import App from './App.vue'
import router from './router'

import { useScriptTag } from '@vueuse/core'

useScriptTag(
    'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5489637365884864',
    () => { },
    {
        crossOrigin: 'anonymous',
        attrs: {
            'data-ad-channel': '1632194211',
            'data-ad-frequency-hint': "30s"
        }
    }
)

const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

app.component('BiBoot', BiBoot)

app.use(pinia)
app.use(router)
app.use(VueGtag, {
    pageTrackerTemplate(to?: RouteLocationNormalized) {
        return {
            page_title: to!.name,
            page_path: to!.path
        } as PageView
    },
    // 7934
    appName: 'Bible Task',
    pageTrackerScreenviewEnabled: true,
    config: {
        id: "G-E900QW126Q"
    }
}, router)
app.use(Popup).use(Toast).use(Lazyload, {
    lazyComponent: true
})


app.use(ScriptX)

app.mount('#app')